<?php
if (isset($_SESSION['openid'])){
    include '../c/config.php';
    $mysqli = new mysqli($dbhost, $dbuser, $dbpwd, $dbName);
    if (!$mysqli->set_charset("utf8")) {printf("Error loading character set utf8: %s\n", $mysqliTwo->error);}
    $openid=$_SESSION['openid'];
    $query=$mysqli->query("select avatar from users where openid='".$openid."'  limit 0,1 ");
    $avatar='';
    if($query->num_rows>0){
    	$userInfo=$query->fetch_assoc();
    	$avatar=$userInfo['avatar'];
    }
    
    $jList=array();
    $query=$mysqli->query("select jname from ling where openid='".$openid."' and jname!=5  ");
    while ($list=$query->fetch_array()){
    	$jList[]=(int)$list['jname'];
    }
    $query=$mysqli->query("select id from ling where openid='".$openid."' and jname=5  limit 0,1 ");
    if($query->num_rows>0){
    	$jList[]=5;
    }
    echo json_encode(array('a'=>$avatar,'l'=>$jList));
}else{
    echo json_encode(array('status'=>'not'));
}
